package com.ykq.controller;

import com.ykq.entity.Role;
import com.ykq.service.RoleService;
import com.ykq.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: keyboard
 * @description:
 * @author: 闫克起2
 * @create: 2023-07-22 15:54
 **/
@RestController
@RequestMapping("role")
public class RoleController {

//    @Resource: 按照名称注入 如果没有对应的名称 在按照类型注入
    @Autowired //按照类型注入
    private RoleService roleService;
    @GetMapping("list")
    public Result list(){
        List<Role> roles = roleService.selectAll();
        return new Result(200,"查询角色成功",roles);
    }
}
